package com.itheima.shop.controller;


import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;


@Controller
@RequestMapping("/demo")
public class DemoController {
	
	private static final Logger logger = LoggerFactory.getLogger(DemoController.class);
	
	@Autowired
	private HttpServletRequest request;
	
	@RequestMapping("/index")
	public String index(@RequestParam(name="number",defaultValue="-1")Integer num) {
		logger.info("num:"+num);
		ArrayList<Integer> arrs = new ArrayList<>();
		for(int i=0;i<10;i++) {
			arrs.add(i);
		}
		request.setAttribute("arrs", arrs);
		logger.info("num:"+arrs);
		return "test";
	}

	
}
